<?php
/**
 * Singgle
 * The main template file for display single page.
 * Author : vthanh_88
 * @package WordPress
*/
get_header();
wp_enqueue_script('validate');
wp_enqueue_script('prettyPhoto');
?>
        	<!-- Portfolio Content Start -->
			<?php
			if(have_posts()): the_post();
			$imagethumb = '';
            $image_fullwidth ='';
            
            
            if(has_post_thumbnail())
            {
            $imageid=get_post_thumbnail_id(get_the_ID());
            $imagethumb = wp_get_attachment_image_src($imageid,'size-680-300');
            $image_fullwidth = wp_get_attachment_image_src($imageid,'size-680-300');
            
            }
?>
<!-- About Content Start -->
	 <div class="wrapper">
        <?php get_sidebar(); ?>		 
    	 <div class="right-panel-outer">
            <div class="right-panel">
                <div class="right-inner">
                    <h2 class="head"><?php the_title(); ?></h2>
                    
                    <div class="blog-post">
                    	<div class="blog-date">
                        	<span><?php echo get_the_time('M'); ?> / <?php echo get_the_time('d'); ?></span>
                            <span><a href="#">15</a></span>
                        </div>
						
                        <div class="mosaic-block bar2">
                            <div class="mosaic-overlay">
                                <div class="details">
                                    <h2><?php the_title(); ?></h2>
                                    <?php
                					$blog_enable_lightbox =get_theme_option('blog','blog_enable_lightbox');
                					if($blog_enable_lightbox=='true') :
    									 if(get_post_meta(get_the_ID(),'post_featured_content',true) == 'Youtube Video'):
									?>
									<div><a rel="prettyPhoto" class="video-icon" href="http://www.youtube.com/watch?v=<?php echo get_post_meta(get_the_ID(),'post_video_id'); ?>" title="<?php the_title(); ?>"></a> <a href="<?php the_permalink(); ?>" class="plus-icon">&nbsp;</a></div>
									<?php
										 elseif(get_post_meta(get_the_ID(),'post_featured_content',true) == 'Vimeo Video'):
									?>
									<div><a rel="prettyPhoto" class="video-icon" href="http://vimeo.com/<?php echo get_post_meta(get_the_ID(),'post_video_id'); ?>" title="<?php the_title(); ?>"></a> <a href="<?php the_permalink(); ?>" class="plus-icon">&nbsp;</a></div>
    								<?php	else:																	 
                					?>
                                    <div><a rel="prettyPhoto" class="zoom-icon" href="<?php echo $image_fullwidth[0]; ?>" title="<?php the_title(); ?>"></a> <a href="<?php the_permalink(); ?>" class="plus-icon">&nbsp;</a></div>
                					<?php
									endif;
                					else : 
                					?>
                					
                					<div><a href="<?php the_permalink(); ?>" class="plus-icon">&nbsp;</a></div>
                					<?php
                					endif;
                					?>
											
                                </div>
                            </div>
                            <div class="mosaic-backdrop"><img src="<?php echo $imagethumb[0];?>" alt=""></div>
                        </div>
                        <div class="clearfix"></div>                        
                    </div>
					 <?php
                  							 $enable_show_category = get_theme_option('blog','blog_enable_category');
                  							 $enable_show_tag = get_theme_option('blog','blog_enable_tag');
                  							 $enable_show_author = get_theme_option('blog','blog_enable_author');
                  							 
                  							 $arr_cats = array();
                  							 $i=0;
                  							 $cats = get_the_category(get_the_ID());
											 
											 $arr_tags = array();
											 $tags = get_the_tags();
                  							 ?>
											 <p class="auth-cat">
                  							<?php  if($enable_show_author =='true'): ?>
                  							<?php echo esc_html('Posted by','TT'); ?> <strong><a href="<?php  echo get_author_posts_url(get_the_author_meta( 'ID' ));  ?>"><?php the_author_meta('nickname'); ?></a></strong>
                  							<?php endif ?> 
											<?php if($cats):
											foreach($cats as $cat): 
                  							$arr_cats[$i]='<strong><a class="clr-link" href="'.get_category_link($cat->cat_ID ).'">'.$cat->cat_name.'</a></strong>';
                  							$i++;

                  							?>
                  							<?php endforeach;
											endif;
											 ?>
											<?php $i = 0;  
											if ($tags) :
											foreach($tags as $tag):
											
                  							$arr_tags[$i]='<strong><a class="clr-link" href="'.get_tag_link($tag->term_id ).'">'.$tag->name.'</a></strong>';
                  							$i++;
                  							?>
                  							<?php endforeach;
											endif;
											 ?>
											
                  							<?php 
                  							if($enable_show_category =='true' & $cats) :
                  							echo esc_html__('In Category : ','TT').implode(',',$arr_cats); 
                  							endif;
											if($enable_show_tag =='true' & $tags) :
                  							echo esc_html__('In tag :   ','TT').implode(',',$arr_tags); 
                  							endif;
											
                  							?>
											</p>
                  							
                    <?php the_content(); ?>
                </div>
                <div class="clearfix"></div>
                <div class="seperator"><img src="<?php echo SKIN_URI; ?>/star_bg.png" alt=""></div>
            	<?php comments_template( '' ); ?>
			</div>
			

            <div class="content-shadow">&nbsp;</div>
        </div>
        <div class="clearfix"></div>
	</div>
<?php
if(get_theme_option('blog','blog_enable_comment') == "true"):	
	
	// CONTACT FORM VALIDATION
echo'<script type="text/javascript">
	jQuery(document).ready(function(){ 
	    function isset(element) {
            return element.length > 0;
        }

		jQuery("#commentform").validate({
			meta: "validate",
			submitHandler: function formcallback(form) {
			
				var error=false;
			    form.submit();
				
				
				';
									
echo				'},';
		
			/* */
echo'			rules: {
				author: "required",
			
				lastname: "required",
				// simple rule, converted to {required:true}
				email: { // compound rule
					required: true,
					email: true
				},

				comment: {
					required: true
				}
			},
			messages: {
				author: "*",
				lastname: "*",
				email: {
					required: "*",
					email: "*"
				},
				comment: "*"
			},
		});
	});		
</script>';	
endif;
endif;
?>
<?php
get_footer(); 
?>